package cn.wolfcode.luowowo.hotel.service;

import cn.wolfcode.luowowo.acticle.domain.Destination;
import cn.wolfcode.luowowo.acticle.mapper.DestinationMapper;
import cn.wolfcode.luowowo.hotel.domain.Hotel;
import cn.wolfcode.luowowo.hotel.mapper.HotelMapper;
import cn.wolfcode.luowowo.hotel.query.HotelQueryObject;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
@Service
public class HotelServiceImpl implements IHotelService {
    @Autowired
    private DestinationMapper destinationMapper;
    @Autowired
    private HotelMapper hotelMapper;

    public List<Destination> list6DestsByFavorHotel() {
        return destinationMapper.select6DestsByFavorHotel();
    }

    public PageInfo query(HotelQueryObject qo) {
            PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize(),qo.getSSortType()+" "+qo.getSSortFlag());
            List<Hotel> list = hotelMapper.selectForList(qo);
            return new PageInfo(list);
    }

}
